package com.tf_cut.admin.platform.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

import com.alibaba.fastjson.JSON;
import com.tf_cut.admin.backend.api.BackEndApi;
import com.tf_cut.admin.common.pojo.PageInfo;
import com.tf_cut.admin.common.pojo.Result;
import com.tf_cut.admin.platform.vo.OrderDetailVO;
import com.tf_cut.admin.platform.vo.SellerAccount;

import lombok.extern.slf4j.Slf4j;

@RestController
@RequestMapping("/platform/profit")
@Slf4j
public class ProfitController {
	
    @Autowired
    private BackEndApi platformGrantApi;
	
    @GetMapping("list")
    public ModelAndView sellerList() {
        return new ModelAndView("platform/profit/list", "sellerAccount", null);
    }
    
    @GetMapping(value = "queryByProfit")
    public Result<PageInfo<SellerAccount>> queryByProfit(@RequestParam("page") int page,
			@RequestParam("rows") int rows,
			@RequestParam("sellerName") String sellerName,
            @RequestParam("startDate") String startDate,
            @RequestParam("endDate") String endDate) {
        String list=platformGrantApi.queryByProfit(page,rows,sellerName,startDate,endDate);
        return Result.of(JSON.parseObject(list, PageInfo.class));
    }
    
    

}
